<div><b class="">User : </b><?php echo$user->ause_name ?></div>
<div class="p-12 grid_13">
<table class="w-i">
    <tr class="f-w-b">
        <td>Privilege</td>
        <td>Position</td>
        <td>Read/Write</td>
        <td>Read only</td>
        <td>Disable</td>
    </tr>
<?php foreach($privileges as $pri): ?>
	<?php 
        $secretkey=time()+rand();
        $signature=md5($pri->apri_id.$secretkey.$salt);
        ?>
    <?php if($_SESSION['auth']['user']->ause_position>=$pri->apri_position):?>
    <tr>
        <td><?php echo $pri->apri_name ?></td>
        <td><?php echo $pri->apri_position ?></td>
        <td>
            <input name="<?php echo $pri->apri_id ?>" 
                   <?php if((int)$pri->aupr_permission==777) echo 'checked="1"' ?>
                   onclick="changeprivilege('<?php echo $user->ause_id ?>','<?php echo $pri->apri_id ?>','777','<?php echo $secretkey ?>','<?php echo $signature ?>')" 
                   value="777" type="radio"/>
        </td>
        <td>
            <input name="<?php echo $pri->apri_id ?>" 
                   <?php if((int)$pri->aupr_permission==755) echo 'checked="1"' ?>
                   onclick="changeprivilege('<?php echo $user->ause_id ?>','<?php echo $pri->apri_id ?>','755','<?php echo $secretkey ?>','<?php echo $signature ?>')" 
                   value="755" type="radio"/>
        </td>
        <td>
            <input name="<?php echo $pri->apri_id ?>" 
                   <?php if((int)$pri->aupr_permission==0) echo 'checked="1"' ?>
                   onclick="changeprivilege('<?php echo $user->ause_id ?>','<?php echo $pri->apri_id ?>','0','<?php echo $secretkey ?>','<?php echo $signature ?>')" 
                   value="0" type="radio"/>
        </td>
    
    
    </tr>
    <?php endif ?>
<?php endforeach ?>
</table>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $('input[type="radio"]').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%'
            
        }).on('ifChecked', function(event){
            $(this).click();
        });
        
    });
</script>